#include<func.h>
void Daemon()
{
    if(fork())
    {
        exit(0);
    }
    setsid();
    chdir("/");
    umask(0);
    int i;
    for(i=0;i<3;i++)
    {
        close(i);
    }
}
int main()
{
    Daemon();
    int  fd;
    fd = open ("/tmp/log", O_CREAT|O_RDWR);
    while(1)
    {
        write(fd,"wohenshuai\n",11);
        sleep(2);

    }
    close(fd);
    return 0;
}